package cn.org.cute.ebocy.config;

import cn.org.cute.ebocy.config.Param.ParamName;

/**
 * 参数名设置
 * @Copyright©2011, 2011 EBO CHANGYOU Co.td. All rights reserved.
 * @Version 1.0.0
 * @since jdk1.6
 * @author xiaolei
 * @date 2011-12-13
 */
public class AppParam {
	
	// 序列化UID
	private static final long serialVersionUID = 7459685922696118034L;

	// 枚举OpenAPI的所有参数名
	public enum AppParamName {	
		
		//基础
		ACK("ACK"),
		MSG("MSG"),
		//初始化
		MY_PRICE("MY_PRICE"),
		GAME_UID("GAME_UID"),
		MY_GOLDS("MY_GOLDS"),
		E_GOLDS("E_GOLDS"),
		MY_TOTAL_GOLDS("MY_TOTAL_GOLDS"),
		//用户信息
		USER_INFO("USER_INFO"),
		PF_ID("PF_ID"),
		PF_NAME("PF_NAME"),
		PIC("PIC"),
		NICK_NAME("NICK_NAME"),
		SEX("SEX"),
		PET_NUM("PET_NUM"),
		OWN_UID("OWN_UID"),
		OWN_PFID("OWN_PFID"),
		OWN_NAME("OWN_NAME"),
		PET_INFOS("PET_INFOS"),
		FRIENDS_INFOS("FRIENDS_INFOS"),
		BUY_PET_INFO("BUY_PET_INFO"),
		TAX("TAX"),
		OWN_INCOME("OWN_INCOME"),//主人收益
		INCOME("INCOME"),//宠物收益
		PET_REG_TIME("PET_REG_TIME"),
		DISCOUNT("DISCOUNT"),
		D_TYPE("D_TYPE"),
		D_TYPE_ID("D_TYPE_ID"),
		//TOKEN
		EBO_TOKEN("EBO_TOKEN"),
		//MESSAGE
		M_INCOME("M_INCOME"),
		REL_UID("REL_UID"),
		REL_UNAME("REL_UNAME"),
		MESSAGE_LIST("MESSAGE_LIST"),
		//查询过滤条件
		a("a"),
		i("i"),
		s("s"),
		g("g"),
		p("p"),
		//排行
		RANK_LIST("RANK_LIST"),
		RANK_ID("RANK_ID"),
		RANK_NUM("RANK_NUM"),
		r("r"),
		//我的道具
		USER_PROP_ID("USER_PROP_ID"),
		PROP_ID("PROP_ID"),
		PROP_NAME("PROP_NAME"),
		PROP_PRICE("PROP_PRICE"),
		PROP_NUM("PROP_NUM"),
		PROP_DESC("PROP_DESC"),
		MY_PROP("MY_PROP"),
		//平台新鲜事
		DATA_PARAM("DATA_PARAM"),
		POST_ID("POST_ID"),
		SEND_UIDS("SEND_UIDS"),
		APP_MESSAGE("APP_MESSAGE"),
		//每天第一次登录
		DAY_FRIST_LOGIN("DAY_FRIST_LOGIN"),
		R_REF("R_REF"),
		//邀请ID
		REQUEST_ID("REQUEST_ID"),
		//活动ID
		A_ID("A_ID"),
		//起昵称
		NAME("NAME");
		
		
		
		
		
		
		// 存储参数名字符串
		private String name; 
		
		private AppParamName(String name) {
			this.name = name;
		}
		
		// 取得参数名字符串
		public String getName() {
			return name;
		}
		
		public String toString() {
			return name;
		}
	}
	
	// 参数名
	private ParamName key;
	// 参数值
	private String value;
	
	
	/**
	 * 根据key和value构造一个参数对象。
	 * 
	 * @param key 参数名
	 * @param value 参数值
	 * @throws OpenException 值value不满足key的格式要求
	 */
	public AppParam(ParamName key, String value) {
		this.key = key;
		this.value =  value;
		
		
			
	}
	/**
	 * @return 以  key=value 格式输出参数。
	 */
	public String toString() {
		StringBuilder buffer = new StringBuilder();
		// 已经限定了参数值value里面不会有特殊字符
		buffer.append(key.getName()).append("=").append(value);
		return buffer.toString();
	}
	
	
	/**
	 * 
	 * @return 以数组 格式输出
	 */
	public String[] toStringArray() {
		String[] toStringArray = new String[2];
		toStringArray[0]=key.getName();
		toStringArray[1]=value;
		return toStringArray;
	}
	

	


	
	
	public static void main(String[] args){
		//使用范例
		//System.err.println(Param.ParamName.APP_ID.name);
		System.err.println(AppParamName.ACK.getName());
	}
}
